//  日常指标页
//  DailyTageViewController.m
//  demo
//
//  Created by Robin-Pc on 2017/5/7.
//  Copyright © 2017年 Robin-Pc. All rights reserved.
//

#import "DailyTageViewController.h"
#import "HeightViewController.h"
#import "DailyBloodSugarViewController.h"
#import "BloodPressureViewController.h"
#import "UrineDoseViewController.h"
#import "WeightViewController.h"
#import "TempratureViewController.h"
#import "BMIViewController.h"
#import "AddViewController.h"

@interface DailyTageViewController ()<WMPageControllerDelegate,WMPageControllerDataSource>
@property (nonatomic, strong) NSArray *titlesArr;

@end

@implementation DailyTageViewController
-(NSArray *)titlesArr{
    if (!_titlesArr) {
        _titlesArr = @[@"血压", @"血糖", @"尿量", @"体温", @"体重", @"身高(儿童)", @"BMI"];
    }
    return _titlesArr;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    self.title = @"日常指标";
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[[UIImage imageNamed:@"返回"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(backAction)];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"添加" style:UIBarButtonItemStylePlain target:self action:@selector(addAction)];
    
    //相关属性
    
}
-(void)backAction{
    [self dismissViewControllerAnimated:YES completion:nil];
}
-(void)addAction{
    UINavigationController *nvc =[[UINavigationController alloc]initWithRootViewController:[AddViewController new]];
    [self presentViewController:nvc animated:YES completion:nil];
}
-(instancetype)init{
    if (self = [super init]) {
        self.showOnNavigationBar = NO;
//        self.viewFrame = CGRectMake(0, 0, SCREEN_WIDTH,SCREEN_HEIGHT-64-44);
        self.menuViewStyle = WMMenuViewStyleFlood;
        self.progressColor = [UIColor colorWithRed:86.0/255.0 green:155.0/255.0 blue:236/255.0 alpha:1] ;
        self.titleSizeNormal = 15;
        self.titleSizeSelected=self.titleSizeNormal;
        self.menuBGColor = [UIColor whiteColor];
        //设置WMPageController每个标题的宽度
        self.menuItemWidth = 80;
        self.progressWidth = 80;
//        self.progressViewCornerRadius
//        UIBezierPath *path = [UIBezierPath bezierPathWithCGPath:self.progressViewCornerRadius];
        
        self.progressViewIsNaughty = 1;
        //设置WMPageController标题栏的高度
        self.menuHeight = 44;
        //设置WMPageController选中的标题的颜色
        self.titleColorSelected = [UIColor whiteColor];
        self.titleColorNormal = [UIColor blackColor];
        
        [self setScrollEnable:NO];
    }
    return self;
}
- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController{
    return self.titlesArr.count;
}
- (__kindof UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index{
    switch (index) {
        case 0:{
            BloodPressureViewController *bpVC = [[BloodPressureViewController alloc] init];
            bpVC.title = @" 血压 ";
            return bpVC;
        }
        case 1:{
            DailyBloodSugarViewController *bsVC = [DailyBloodSugarViewController new];
            bsVC.title = @" 血糖 ";
            return bsVC;
        }
        case 2:{
            UrineDoseViewController *udVC = [UrineDoseViewController new];
            udVC.title = @" 尿量 ";
            return udVC;
        }
        case 3:{
            TempratureViewController *bpVC = [[TempratureViewController alloc] init];
            bpVC.title = @" 体温 ";
            return bpVC;
        }
        case 4:{
            WeightViewController *wVC = [WeightViewController new];
            wVC.title = @" 体重 ";
            return wVC;
        }
        case 5:{
            HeightViewController *hVC = [HeightViewController new];
            hVC.title = @" 身高 ";
            return hVC;
        }
        case 6:{
            BMIViewController *vc = [BMIViewController new];
            vc.title = @" BMI ";
            return vc;
        }
        default:
            return nil;
    }
    
}
- (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index{
    return  self.titlesArr[index];
}
@end
